#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define rep(i, a, b) for (int i = (a); i <= (b); i++)
#define per(i, a, b) for (int i = (a); i >= (b); i--)
#define endl '\n'
const int N = 1e5 + 5;

int n, m, q;
int a[N];
struct Range {
  int op, l, r;
} b[N];
int cnt[N << 2], tag[N << 2];
int val;
void pushup(int p) { cnt[p] = cnt[p << 1] + cnt[p << 1 | 1]; }
void build(int p, int l, int r) {
  tag[p] = -1;
  if (l == r) {
    cnt[p] = a[l] < val ? 0 : 1;
    return;
  }
  int mid = (l + r) >> 1;
  build(p << 1, l, mid);
  build(p << 1 | 1, mid + 1, r);
  pushup(p);
}
void addtag(int x, int p, int l, int r) {
  tag[p] = x;
  cnt[p] = (r + 1 - l) * x;
}
void pushdown(int p, int l, int r) {
  if (tag[p] != -1) {
    int mid = (l + r) >> 1;
    addtag(tag[p], p << 1, l, mid);
    addtag(tag[p], p << 1 | 1, mid + 1, r);
    tag[p] = -1;
  }
}
void update(int L, int R, int x, int p, int l, int r) {
  if (L > R) return;
  if (L <= l && R >= r) {
    addtag(x, p, l, r);
    return;
  }
  pushdown(p, l, r);
  int mid = (l + r) >> 1;
  if (L <= mid) update(L, R, x, p << 1, l, mid);
  if (R > mid) update(L, R, x, p << 1 | 1, mid + 1, r);
  pushup(p);
}
int query(int L, int R, int p, int l, int r) {
  if (L <= l && R >= r) return cnt[p];
  pushdown(p, l, r);
  int mid = (l + r) >> 1;
  int res = 0;
  if (L <= mid) res += query(L, R, p << 1, l, mid);
  if (R > mid) res += query(L, R, p << 1 | 1, mid + 1, r);
  return res;
}
bool check(int x) {
  val = x;
  build(1, 1, n);
  rep(i, 1, m) {
    int l = b[i].l, r = b[i].r;
    int tot = query(l, r, 1, 1, n);
    if (b[i].op == 0) {
      int mid = r + 1 - tot;
      update(l, mid - 1, 0, 1, 1, n);
      update(mid, r, 1, 1, 1, n);
    } else {
      int mid = l + tot;
      update(l, mid - 1, 1, 1, 1, n);
      update(mid, r, 0, 1, 1, n);
    }
  }
  int tot = query(q, q, 1, 1, n);
  return tot == 1;
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n >> m;
  rep(i, 1, n) cin >> a[i];
  rep(i, 1, m) {
    cin >> b[i].op >> b[i].l >> b[i].r;
    if (b[i].l > b[i].r) swap(b[i].l, b[i].r);
  }
  cin >> q;
  while (m && (b[m].l > q || b[m].r < q)) m--;
  int l = 0, h = 1e9;
  while (l <= h) {
    int mid = (l + h) >> 1;
    if (check(mid))
      l = mid + 1;  // mid < x
    else
      h = mid - 1;
  }
  cout << l - 1;
  return 0;
}